home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Mail / EnhanceMail.1.3 / Source / TocMatrix.m < prev    next >
Encoding:
Text File  |  1996-03-20  |  2.1 KB  |  80 lines

  1. /* -*-C-*-
  2. *******************************************************************************
  3. *
  4. * File:         TocMatrix.m
  5. * RCS:          $Header: /usr/local/lib/cvs/EnhanceMail/TocMatrix.m,v 1.1.1.3 1996/03/20 17:18:52 cedman Exp $
  6. * Description:  
  7. * Author:       Carl Edman
  8. * Created:      Fri Oct 20 14:47:00 1995
  9. * Modified:     Wed Mar 20 12:18:29 1996 (Carl Edman) cedman@capitalist.princeton.edu
  10. * Language:     C
  11. * Package:      N/A
  12. * Status:       Experimental (Do Not Distribute)
  13. *
  14. * (C) Copyright 1995, but otherwise this file is perfect freeware.
  15. *
  16. *******************************************************************************
  17. */
  18.  
  19. #import "EnhanceMail.h"
  20. #import <regex.h>
  21. #import "TocMatrix.h"
  22. #import "MailBox.h"
  23. #import "SimpleString.h"
  24.  
  25. static id cellar=nil;
  26.  
  27. @implementation EnhanceTocMatrix
  28. + finishLoading:(struct mach_header *)header
  29.    {
  30.    [self poseAs:[self superclass]];
  31.    return self;
  32.    }
  33.  
  34. - findForward:(BOOL)forward all:(BOOL)all
  35.    {
  36.    id panel=[FindPanel new];
  37.    id box=[[window delegate] mailbox];
  38.    id ret;
  39.  
  40.    if ([panel searchMessage]&&![panel regExpr]&&(box!=nil)&&[box hasStore])
  41.       {
  42.       id list=nil,tmp=nil;
  43.       int i;
  44.       
  45.       if (cellar==nil) cellar=[[HashTable alloc] init];
  46.  
  47.       tmp=[[SimpleString alloc] init];
  48.       [tmp appendString:"whole(Content parse("];
  49.       [tmp appendString:[panel findField]];
  50.       [tmp appendString:"))"];
  51.       list=[box query:[tmp string]];
  52.       tmp=[tmp free];
  53.       
  54.       if (list!=nil)
  55.          {
  56.          for(i=[list count]-1;i>=0;i--)
  57.             {
  58.             tmp=[self cellForMsgId:[[list objectAt:i] msgId]];
  59.             if (tmp) [cellar insertKey:tmp value:tmp];
  60.             }
  61.          list=[[list freeObjects] free];
  62.          }
  63.       }
  64.    else
  65.       {
  66.       if (cellar!=nil) cellar=[cellar free];
  67.       }
  68.       
  69.    ret=[super findForward:forward all:all];
  70.    if (cellar!=nil) cellar=[cellar free];
  71.    return ret;
  72.    }
  73.  
  74. - (BOOL)cell:fp16 containsRegExpr:(struct regex *)fp20 searchMessage:(BOOL)fp24
  75.    {
  76.    if ((cellar!=nil)&&![cellar isKey:fp16]) return NO;
  77.    return [super cell:fp16 containsRegExpr:fp20 searchMessage:fp24];
  78.    }
  79. @end
  80.